package com.zrq.gencode.properties;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Properties;

import com.zrq.gencode.exception.ConfigationException;

/**
 * @author zhong
 * &#064;date  2020年1月8日
 */
public class Propertiez {
    private static final String PROPERTIES = "src/main/resources/gencode.properties";
    public static Properties properties = new Properties();

    static {
        File file = new File(PROPERTIES);
	    try (InputStream in = new FileInputStream(file)) {
		    // 指定 UTF-8 编码加载 properties 文件
		    properties.load(new InputStreamReader(in, StandardCharsets.UTF_8));
	    } catch (FileNotFoundException e) {
		    throw new ConfigationException("配置文件gencode.properties未找到");
	    } catch (IOException e) {
		    throw new ConfigationException("加载配置失败");
	    }
    }
}